package cn.tedu.controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.tedu.entity.Province;
import cn.tedu.service.CovService;
import cn.tedu.service.CovServiceImpl;

public class CovServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		request.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		
		CovService service=new CovServiceImpl();
		List<Province> list = service.qureyAllProvinces();
		System.out.println("controller:"+list);
		request.setAttribute("list",list);
		
		List<Province> list5 = service.queryByTop5();
		System.out.println("controller:"+list5);
		request.setAttribute("list5",list5);
		
		request.getRequestDispatcher("nCov2019.jsp").forward(request, response);
		
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}
}
